# -*- coding: utf-8 -*-
import bsddb
import simplejson as json

DOC_DB = "doc.db"

def isValid(obj):
    """"""
    if type(obj)!= type({}):
        return False
    if not obj.has_key("tag"):
        return False
    return True
        

def loadDocs():
    db = bsddb.btopen(DOC_DB, "c")
    
    return db



    
if __name__ == "__main__":
    
    #for i in  range(10):
    #doc = {"tag":"linux",u"name":u"asd独守空房asd====="}
    #addDoc(doc)
    
    db = loadDocs()
    print len(db)
        
        
        

     
    
    
    
    
    
    
    
    
    
    
    
    